# use third libs
if(OS_WINDOWS)
  set(glfw_SOURCE_DIR ${COMMON_THIRD_LIB}/glfw)
  set(gles_SOURCE_DIR ${COMMON_THIRD_LIB}/gles)
  set(glm_SOURCE_DIR ${THIRD_LIB}/glm)
elseif(OS_LINUX)
  find_package(glfw3 REQUIRED)
endif()

macro(use_glfw ag_project_name)
  target_compile_definitions(${ag_project_name} PRIVATE USE_LIB_GLFW)
  
  if(OS_WINDOWS)
    target_include_directories(${ag_project_name} PRIVATE ${glfw_SOURCE_DIR}/dist/$<CONFIG>/include)
    target_link_directories(${ag_project_name} PRIVATE ${glfw_SOURCE_DIR}/dist/$<CONFIG>/lib)
    target_link_libraries(${ag_project_name} PRIVATE OpenGL32 glfw3)
  elseif(OS_LINUX)
    target_link_libraries(${ag_project_name} PRIVATE GL glfw)
  endif()
endmacro(use_glfw)

macro(use_gles ag_project_name)
  target_compile_definitions(${ag_project_name} PRIVATE USE_LIB_GLES)
  
  if(OS_WINDOWS)
    target_include_directories(${ag_project_name} PRIVATE ${gles_SOURCE_DIR}/include)
    target_link_directories(${ag_project_name} PRIVATE ${gles_SOURCE_DIR})
    target_link_libraries(${ag_project_name} PRIVATE libEGL libGLESv2)
  elseif(OS_LINUX)
    #
  endif()
endmacro(use_gles)

macro(use_glm ag_project_name)
  target_compile_definitions(${ag_project_name} PRIVATE USE_LIB_GLM)
  
  # include glm_SOURCE_DIR ==> 
  target_include_directories(${ag_project_name} PRIVATE ${glm_SOURCE_DIR})
endmacro(use_glm)